home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / winterp-1.13 / examples / Form2.lsp < prev    next >
Encoding:
Lisp/Scheme  |  1991-10-05  |  4.5 KB  |  132 lines

  1. ; -*-Lisp-*-
  2. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3. ;
  4. ; File:         form-widg2.lsp
  5. ; RCS:          $Header: Form2.lsp,v 1.2 91/10/05 02:58:10 mayer Exp $
  6. ; Description:  Form widget layout -- similar to formtest.c on p 91-92 of
  7. ;        Doug Young's Motif book.    
  8. ; Author:       Niels Mayer, HPLabs
  9. ; Created:      Fri Jul 27 00:59:56 1990
  10. ; Modified:     Sat Oct  5 02:57:51 1991 (Niels Mayer) mayer@hplnpm
  11. ; Language:     Lisp
  12. ; Package:      N/A
  13. ; Status:       X11r5 contrib tape release
  14. ;
  15. ; WINTERP Copyright 1989, 1990, 1991 Hewlett-Packard Company (by Niels Mayer).
  16. ; XLISP version 2.1, Copyright (c) 1989, by David Betz.
  17. ;
  18. ; Permission to use, copy, modify, distribute, and sell this software and its
  19. ; documentation for any purpose is hereby granted without fee, provided that
  20. ; the above copyright notice appear in all copies and that both that
  21. ; copyright notice and this permission notice appear in supporting
  22. ; documentation, and that the name of Hewlett-Packard and Niels Mayer not be
  23. ; used in advertising or publicity pertaining to distribution of the software
  24. ; without specific, written prior permission.  Hewlett-Packard and Niels Mayer
  25. ; makes no representations about the suitability of this software for any
  26. ; purpose.  It is provided "as is" without express or implied warranty.
  27. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  28.  
  29. (defun motif-1.1-p () 
  30.   (and (eq *MOTIF_VERSION* 1) (eq *MOTIF_REVISION* 1)))
  31.  
  32. (setq toplevel_w
  33.       (send TOP_LEVEL_SHELL_WIDGET_CLASS :new "form2shl"
  34.         :XMN_GEOMETRY    (if (motif-1.1-p)
  35.                     "+1+1"
  36.                     "300x300+1+1") ;work around Motif 1.0 form-sizing bug.
  37.         :XMN_TITLE        "Winterp:RC-SHELL"
  38.         :XMN_ICON_NAME    "W:RC-SHELL"
  39.         ))
  40.  
  41. (setq form_w
  42.       (send XM_FORM_WIDGET_CLASS :new :managed
  43.         "form" toplevel_w
  44.         ))
  45.  
  46. ;;
  47. ;; place 5 equal-sized buttons attached to the right side of the form widget
  48. ;; we specify the :xmn_{top,bottom}_attachment resources as :attach_position,
  49. ;; which means that we must specify the :xmn_top_position, :xmn_bottom_position
  50. ;; as the vertical percentage taken up by each button. (for 5 buttons, that means
  51. ;; each button takes up approx 20% (make that 18 + 2 for spacing)...
  52. ;; if more buttons are specified, the percentages must be changed to the
  53. ;; appropriate value.
  54. ;;
  55.  
  56. (setq pb0_w
  57.       (send XM_TEXT_WIDGET_CLASS :new :managed
  58.         "pb0" form_w
  59.         :XMN_STRING        "Mothra\nIn\nPupa\nStage"
  60.         :XMN_EDIT_MODE        :multi_line_edit
  61.         :XMN_TOP_ATTACHMENT        :attach_form
  62.         :XMN_BOTTOM_ATTACHMENT    :attach_form
  63.         :XMN_LEFT_ATTACHMENT    :attach_form
  64.         ))
  65.  
  66. (setq pb1_w
  67.       (send XM_PUSH_BUTTON_WIDGET_CLASS :new :managed
  68.         "pb1" form_w
  69.         :XMN_LABEL_STRING        "Jack In"
  70.         :XMN_TOP_ATTACHMENT        :attach_position
  71.         :XMN_BOTTOM_ATTACHMENT    :attach_position
  72.         :XMN_TOP_POSITION        0
  73.         :XMN_BOTTOM_POSITION    20
  74.         :XMN_RIGHT_ATTACHMENT    :attach_form
  75.         :XMN_LEFT_ATTACHMENT    :attach_widget
  76.         :XMN_LEFT_WIDGET        pb0_w
  77.         ))
  78.  
  79. (setq pb2_w
  80.       (send XM_PUSH_BUTTON_WIDGET_CLASS :new :managed
  81.         "pb2" form_w
  82.         :XMN_LABEL_STRING        "Jack Out"
  83.         :XMN_TOP_ATTACHMENT        :attach_position
  84.         :XMN_BOTTOM_ATTACHMENT    :attach_position
  85.         :XMN_TOP_POSITION        20
  86.         :XMN_BOTTOM_POSITION    40
  87.         :XMN_RIGHT_ATTACHMENT    :attach_form
  88.         :XMN_LEFT_ATTACHMENT    :attach_widget
  89.         :XMN_LEFT_WIDGET        pb0_w
  90.         ))
  91.  
  92. (setq pb3_w
  93.       (send XM_PUSH_BUTTON_WIDGET_CLASS :new :managed
  94.         "pb3" form_w
  95.         :XMN_LABEL_STRING        "Do Watoosi"
  96.         :XMN_TOP_ATTACHMENT        :attach_position
  97.         :XMN_BOTTOM_ATTACHMENT    :attach_position
  98.         :XMN_TOP_POSITION        40
  99.         :XMN_BOTTOM_POSITION    60
  100.         :XMN_RIGHT_ATTACHMENT    :attach_form
  101.         :XMN_LEFT_ATTACHMENT    :attach_widget
  102.         :XMN_LEFT_WIDGET        pb0_w
  103.         ))
  104.  
  105. (setq pb4_w
  106.       (send XM_PUSH_BUTTON_WIDGET_CLASS :new :managed
  107.         "pb4" form_w
  108.         :XMN_LABEL_STRING        "Begin Hyperreality"
  109.         :XMN_TOP_ATTACHMENT    :attach_position
  110.         :XMN_BOTTOM_ATTACHMENT    :attach_position
  111.         :XMN_TOP_POSITION        60
  112.         :XMN_BOTTOM_POSITION    80
  113.         :XMN_RIGHT_ATTACHMENT    :attach_form
  114.         :XMN_LEFT_ATTACHMENT    :attach_widget
  115.         :XMN_LEFT_WIDGET        pb0_w
  116.         ))
  117.  
  118. (setq pb5_w
  119.       (send XM_PUSH_BUTTON_WIDGET_CLASS :new :managed
  120.         "pb5" form_w
  121.         :XMN_LABEL_STRING        "Winterpmute"
  122.         :XMN_TOP_ATTACHMENT        :attach_position
  123.         :XMN_BOTTOM_ATTACHMENT    :attach_position
  124.         :XMN_TOP_POSITION        80
  125.         :XMN_BOTTOM_POSITION    100
  126.         :XMN_RIGHT_ATTACHMENT    :attach_form
  127.         :XMN_LEFT_ATTACHMENT    :attach_widget
  128.         :XMN_LEFT_WIDGET        pb0_w
  129.         ))
  130.  
  131. (send toplevel_w :realize)
  132.